//
//  KCKitMacro.h
//  demo12-12
//
//  Created by king on 2017/12/13.
//  Copyright © 2017年 KC. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <sys/time.h>
#import <pthread.h>

#ifndef KCKitMacro_h
#define KCKitMacro_h

#ifdef __cplusplus
#define KC_EXTERN_C_BEGIN extern "C" {
#define KC_ECTERN_C_END }
#else
#define KC_EXTERN_C_BEGIN
#define KC_EXTERN_C_END
#endif

KC_EXTERN_C_BEGIN

#ifndef KC_CLAMP
#define KC_CLAMP(_x_,_low_,_high_) (((_x_) > (_high_)) ? (_high_) : (((_x_) < (_low_)) ? (_low_) : (_x_)))
#endif

#ifndef KC_SWAP
#define KC_SWAP(_a_,_b_) do { __typeof__(_a_) _tmp_ = (_a_); (_a_) = (_b_); (_b_) = _tmp_;} while (0)
#endif

#ifndef YYSYNTH_DUMMY_CLASS
#define YYSYNTH_DUMMY_CLASS(_name_) \
@interface YYSYNTH_DUMMY_CLASS_ ## _name_ : NSObject @end \
@implementation YYSYNTH_DUMMY_CLASS_ ## _name_ @end
#endif

#ifndef KC_DUMMY_CLASS
#define KC_DUMMY_CLASS(_class_)\
@interface _class_ : NSObject @end\
@implementation _class_ @end
#endif


#define SINGLETON_FOR_CLASS(classname)\
\
 + (instancetype)sharedInstance\
{\
static dispatch_once_t pred;\
static classname *shared = nil;\
duspatch_once(&pred,^{\
shared = [[calssname alloc]init];\
});\
return shared\
}






KC_EXTERN_C_END


#endif /* KCKitMacro_h */
